package com.maxiaowei.controller;

import com.maxiaowei.pojo.Stu;
import com.maxiaowei.service.StuService;
import io.swagger.v3.oas.annotations.Hidden;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 功能描述:
 * <p>
 * 作者: maxiaowei
 */
//@Controller
@RestController
@Hidden
public class StuFooController {

    @Autowired
    private StuService stuService;

    @GetMapping("/getStu")
    public Object getStu(String id) {
        return stuService.getStuInfoById(Integer.parseInt(id));
    }

    @PostMapping("/saveStu")
    public Object saveStu() {
        stuService.saveStu();
        return "success";
    }

    @PostMapping("/updateStu")
    public Object updateStu(String id) {
        stuService.updateStu(Integer.parseInt(id));
        return "success";
    }

    @PostMapping("/deleteStu")
    public Object deleteStu(String id) {
        stuService.deleteStu(Integer.parseInt(id));
        return "success";
    }

}
